#!/bin/bash

BRANCH=`git rev-parse --abbrev-ref HEAD`
echo "on branch $BRANCH"

set -e

if [[ $BRANCH == "master" ]];
then
  yarn lerna publish --yes
elif [[ $BRANCH == "alpha" ]];
then
  yarn lerna publish --conventional-prerelease --yes --preid $BRANCH --dist-tag $BRANCH
else
  echo "Nothing to publish on branch $BRANCH..."
fi
